/* Copyright (c) 2010, Peter Lényi */
/* Licensed under The BSD License. */

package gem.apps.fs.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Entity class FileMeta represents meta data associated with uploaded file.
 * 
 * @author Peter Lényi
 * @version 20100425F2
 */
@Entity
@Table(name="filemeta")
public class FileMeta implements Serializable
{
    public static final long serialVersionUID = 1l;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private long uin;
    private String originalName;
    private String title;
    @Temporal(value=TemporalType.DATE)
    private Date uploaded;
    private String comment;
    private String owner;
    private String password;
    private String mime;

    public FileMeta() {}

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getOriginalName() {
        return originalName;
    }

    public void setOriginalName(String originalName) {
        this.originalName = originalName;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public long getUin() {
        return uin;
    }

    public void setUin(long uin) {
        this.uin = uin;
    }

    public Date getUploaded() {
        return uploaded;
    }

    public void setUploaded(Date uploaded) {
        this.uploaded = uploaded;
    }

    public String getMime() {
        return mime;
    }

    public void setMime(String mime) {
        this.mime = mime;
    }

    @Override
    public boolean equals(Object o) {
        boolean equal = false;
        if (o != null || o instanceof FileMeta) {
            FileMeta fm = (FileMeta) o;
            if (uin == fm.uin) {
                equal = true;
            }
        }
        return equal;
    }

    @Override
    public int hashCode() {
        return new Long(uin).hashCode();
    }

    @Override
    public String toString() {
        return title;
    }
}
